import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { Nyt7PolicyInsuranceVO, Nyt7PolicyInsuranceForm, Nyt7PolicyInsuranceQuery } from '@/api/Nyt7PolicyInsurance/Nyt7PolicyInsurance/types';

/**
 * 查询保单查询列表
 * @param query
 * @returns {*}
 */

export const listNyt7PolicyInsurance = (query?: Nyt7PolicyInsuranceQuery): AxiosPromise<Nyt7PolicyInsuranceVO[]> => {
  return request({
    url: '/Nyt7PolicyInsurance/Nyt7PolicyInsurance/list',
    method: 'get',
    params: query
  });
};

export const allNyt7PolicyInsurance = () => {
  return request({
    url: '/Nyt7PolicyInsurance/Nyt7PolicyInsurance/all',
    method: 'get'
  });
};

/**
 * 查询保单查询详细
 * @param id
 */
export const getNyt7PolicyInsurance = (id: string | number): AxiosPromise<Nyt7PolicyInsuranceVO> => {
  return request({
    url: '/Nyt7PolicyInsurance/Nyt7PolicyInsurance/' + id,
    method: 'get'
  });
};

/**
 * 新增保单查询
 * @param data
 */
export const addNyt7PolicyInsurance = (data: Nyt7PolicyInsuranceForm) => {
  return request({
    url: '/Nyt7PolicyInsurance/Nyt7PolicyInsurance',
    method: 'post',
    data: data
  });
};

/**
 * 修改保单查询
 * @param data
 */
export const updateNyt7PolicyInsurance = (data: Nyt7PolicyInsuranceForm) => {
  return request({
    url: '/Nyt7PolicyInsurance/Nyt7PolicyInsurance',
    method: 'put',
    data: data
  });
};

/**
 * 删除保单查询
 * @param id
 */
export const delNyt7PolicyInsurance = (id: string | number | Array<string | number>) => {
  return request({
    url: '/Nyt7PolicyInsurance/Nyt7PolicyInsurance/' + id,
    method: 'delete'
  });
};


//获取总结的之后的信息

// export const allNyt7PolicyInsurance = (query?: Nyt7PolicyInsuranceQuery): AxiosPromise<Nyt7PolicyInsuranceVO[]> => {
//   return request({
//     url: '/Nyt7PolicyInsurance/Nyt7PolicyInsurance/all',
//     method: 'get',
//     params: query
//   });
// };

export function getPolicyCount() {
  return request({
    url: '/Nyt7PolicyInsurance/Nyt7PolicyInsurance/count',
    method: 'get'
  });
}

export function getPolicyCompanyCount() {
  return request({
    url: '/Nyt7PolicyInsurance/Nyt7PolicyInsurance/companyCount',
    method: 'get'
  });
}

export function searchEntityFarmer(query?: string): AxiosPromise<any> {
  return request({
    url: '/Nyt7PolicyInsurance/Nyt7PolicyInsurance/searchEntityFarmer',
    method: 'get',
    params: { query }
  });
}

export function searchEntityPlot(query?: string): AxiosPromise<any> {
  return request({
    url: '/Nyt7PolicyInsurance/Nyt7PolicyInsurance/searchEntityPlot',
    method: 'get',
    params: { query }
  });
}




 /**
    * 导出选中的保单查询列表
    * @param ids
    */
   export const exportSelected = (ids: number[]): AxiosPromise<Blob> => {
     return request({
       url: '/Nyt7PolicyInsurance/Nyt7PolicyInsurance/exportSelected',
       method: 'post',
       data: ids,
       responseType: 'blob'
     });
   };